import junit.framework.TestCase;

/**
 * 
 * @author Dr. Zahid Anwar
 *
 * Unit tests for TeaMaker class.
 */
public class TeaMakerTest extends TestCase {
	
	private TeaMaker tm;
	private Recipe r1;
	private Recipe r2;
	private Recipe r3;
	private Recipe r4;

	protected void setUp() throws Exception {
		tm = new TeaMaker();
		
		//Set up for r1
		r1 = new Recipe();
		r1.setName("Tea");
		r1.setAmthotwater("0");
		r1.setAmtTea("3");
		r1.setAmtMilk("1");
		r1.setAmtSugar("1");
		r1.setPrice("50");
		
		//Set up for r2
		r2 = new Recipe();
		r2.setName("Mocha");
		r2.setAmthotwater("20");
		r2.setAmtTea("3");
		r2.setAmtMilk("1");
		r2.setAmtSugar("1");
		r2.setPrice("75");
		
		//Set up for r3
		r3 = new Recipe();
		r3.setName("Latte");
		r3.setAmthotwater("0");
		r3.setAmtTea("3");
		r3.setAmtMilk("3");
		r3.setAmtSugar("1");
		r3.setPrice("100");
		
		//Set up for r4
		r4 = new Recipe();
		r4.setName("Hot hotwater");
		r4.setAmthotwater("4");
		r4.setAmtTea("0");
		r4.setAmtMilk("1");
		r4.setAmtSugar("1");
		r4.setPrice("65");
		
		super.setUp();
	}
	
	public void testAddInventory() {
		try {
			tm.addInventory("4","7","0","9");
		} catch (InventoryException e) {
			fail("InventoryException should not be thrown");
		}
	}
	
	public void testAddInventoryException() {
		try {
			tm.addInventory("4", "-1", "asdf", "3");
			fail("InventoryException should be thrown");
		} catch (InventoryException e) {
			//success if thrown
		}
	}
	
	public void testMaketea() {
		tm.addRecipe(r1);
		assertEquals(25, tm.makeTea(0, 75));
	}

}
